#__author__:"heng"
#__date__: $(DATE)

import inspect
import functools


# 类型检查
def check_type(func):
    sig = inspect.getfullargspec(func)

    @functools.wraps(func)
    def wrapper(*args, **kw):
        try:
            for arg, key in zip(list(args) + list(kw.values()), sig.args):
                if not isinstance(arg, sig.annotations[key]):
                    raise TypeError("need a %s" % sig.annotations[key])
                else:
                    return func(*args, **kw)
        except Exception:
            raise

    return wrapper




